using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace TidhiGanitam.DataModel
{
    public class TidhiDetails
    {
        Enums.TidhiState m_TidhiState;
        double m_Tidhi;
        DateTime m_EndDate;
        Rasi m_EndTime;
        int m_Masamu;
        bool m_AdhikaMasamu;

        public Enums.TidhiState TidhiState
        {
            get
            { return m_TidhiState; }
            set
            { m_TidhiState = value; }
        }
        public double TidhiIndex
        {
            get
            { return m_Tidhi; }
            set
            { m_Tidhi = value; }
        }
        public string Tidhi
        {
            get
            { return Constants.SuddaTidhi[Convert.ToInt32(TidhiIndex)].ToString();}
        }
        public string Masamu
        {
            get
            {
                string masamu = Constants.Masamu[m_Masamu].ToString();
                if (m_AdhikaMasamu)
                    masamu = "Adhika. " + masamu;
                return masamu; }
        }
        public DateTime EndDate
        {
            get
            { return m_EndDate; }
            set
            {
                m_EndDate = value;
            }
        }
        public Rasi EndTime
        {
            get
            { return m_EndTime; }
            set
            { m_EndTime = value; }
        }
        public TidhiDetails(int MasamuIndex, double TidhiIndex, Enums.TidhiState TidhiState, DateTime EndDate, Rasi EndTime, bool AdhikaMasamu)
        {
            m_Masamu = MasamuIndex;
            m_Tidhi = TidhiIndex;
            m_TidhiState = TidhiState;
            m_EndDate = EndDate;
            m_EndTime = EndTime;
            m_AdhikaMasamu = AdhikaMasamu;
        }
        public string GetTidhiDetailsString(Rasi SuryodayamuTime)
        {
            string TidhiString = Tidhi;
            if (TidhiState == Enums.TidhiState.Eshyam)
            {
                TidhiString = "Eshya(" + Tidhi + ")";
            }
            else if (TidhiState == Enums.TidhiState.Purti)
            {
                TidhiString = Tidhi + " Purti";
            }
            string retString = string.Format("{0} {1} ({2})", TidhiString, EndTime.DisplayFormat(Enums.DisplayFormat.LV),
                EndTime.GetTimeFormatString(new Rasi(SuryodayamuTime), true));
            return retString;
        }
    }
}
